import tool from 'src/util/tool'
import util from '_util/index'
const store = util.store
import _ from 'lodash'

function ckCity(_this,vo) {
  let from_city=vo['from_city']?JSON.parse(vo['from_city']):[];
  let to_city=vo['to_city']?JSON.parse(vo['to_city']):[];
  let city_list=vo['city_list']?JSON.parse(vo['city_list']):[];
  let b = city_list.length > 0 && (from_city.length == 0 || to_city.length == 0);
  if(b) {
    util.showMsg(_this, 'quick_error', '有途经城市必须有出发城市和目的地城市！');
    return false;
  }
  return true;
}

export default{
  valid(_this,mid) {
    let vo = util.store.get(_this, 'editVo');
    switch (Number(mid)) {
      case 42:
        return ckCity(_this,vo);
        break;
    }
    return true;
  }
}
